package com.mby.utils;

import com.mby.entity.Error;
/**
 * Created by noah on 2018/1/30.
 */
public class MbyException extends RuntimeException {

    private static final long serialVersionUID = -7638041501183925225L;

    private Integer code;
    private String exceptionInfo;
    private Integer debugId;
    private Object data;

    public MbyException(Integer errorCode) {
        super(errorCode.toString());
        this.code = errorCode;
    }

    public MbyException(Error error) {
        super(error.getMsg());
        this.code = error.getCode();
        this.data = error.getData();
    }

    public MbyException(Error error, Object data) {
        super(error.getMsg());
        this.code = error.getCode();
        this.data = data;
    }

    public MbyException(String exceptionInfo, Integer debugId, Object data) {
        super(exceptionInfo);
        this.exceptionInfo = exceptionInfo;
        this.debugId = debugId;
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getDebugId() {
        return debugId;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getExceptionInfo() {
        return exceptionInfo;
    }

    public void setExceptionInfo(String exceptionInfo) {
        this.exceptionInfo = exceptionInfo;
    }
}
